﻿using System;
using TechTalk.SpecFlow;
using FluentAssertions;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Support;
using OpenQA.Selenium.Support.UI;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Remote;

namespace DocProcessingWorkFlowScenarios
{
    [Binding]
    public class BBOSLogonPageValidationSteps
    {

        BBOS_LoginPage loginPage = new BBOS_LoginPage();

        [Given]
        public void Given_I_am_registered()
        {
            BrowserUtility.Current.Navigate().GoToUrl("http://dev.nexdox.com/DocProcessingWorkflow/session/new");
        }

        [Given]
        public void Given_I_am_not_logged_on()
        {
            if (!BrowserUtility.Current.PageSource.Contains("LOG IN"))
            {
                BrowserUtility.Current.FindElement(By.LinkText("Log off")).Click();
            } 
        }

        [Given]
        public void Given_I_do_not_enter_any_details()
        {
        }

        [Given]
        public void Given_I_press_submit()
        {
            loginPage.ClickSubmit();
            //BrowserUtility.Current.FindElement(By.ClassName("btn-login")).Click();
            
        }

     

        [Then]
        public void Then_Field_valdation_messages_displayed()
        {

            loginPage.UsernameValidation();
            loginPage.PasswordValidation();

            //Assert.IsTrue(BrowserUtility.Current.PageSource.Contains("The Username field is required."));
            //Assert.IsTrue(BrowserUtility.Current.PageSource.Contains("The Password field is required."));

            //BrowserUtility.Current.Close();
            //BrowserUtility.Current.Dispose();
        }
    }
}
